<template>
  <div class="number">
    <p class="name">{{ name }}</p>
    <div class="content">
      <countTo
        class="num"
        :start-val="startVal"
        :end-val="endVal"
        :duration="3000"
      />
      <span class="unit">{{ unit }}</span>
    </div>
  </div>
</template>

<script>
import countTo from 'vue-count-to'
export default {
  components: { countTo },
  props: {
    name: {
      type: String,
      default: ''
    },
    unit: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      startVal: 0,
      endVal: 2017
    }
  }
}
</script>

<style lang="scss" scoped>
.number {
  height: 100px;
  color: #ffffff;
  padding: 10px;
  position: relative;
  .name {
    font-size: 16px;
    position: absolute;
    left: 20px;
    top: 10px;
  }
  .content {
    height: 100%;
    text-align: center;
    line-height: 80px;
    .unit {
      font-size: 24px;
    }
    .num {
      font-size: 62px;
    }
  }
}
</style>
